home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / tools / Block.lua < prev    next >
Text File  |  2010-02-20  |  1KB  |  39 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Block
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, August 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.block={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.block.gfx_wpn=loadgfx("buildings/block.bmp")                            -- Weapon Image
  13. setmidhandle(cc.block.gfx_wpn)
  14. cc.block.sfx_build=loadsfx("buildstone.ogg")                            -- Build Sound
  15.  
  16. --------------------------------------------------------------------------------
  17. -- Weapon: Block
  18. --------------------------------------------------------------------------------
  19.  
  20. cc.block.id=addweapon("cc.block","Block",cc.block.gfx_wpn,3)            -- Add Weapon (3 uses)
  21.  
  22. function cc.block.draw()                                                -- Draw
  23.     -- HUD Positioning
  24.     if weapon_shots==0 then
  25.         hudpositioning(pos_build,cc.block.gfx_wpn)
  26.     end
  27. end
  28.  
  29. function cc.block.attack(attack)                                        -- Attack
  30.     if (weapon_shots<=0) and (weapon_position==1) then
  31.         -- Use weapon and allow to use another one afterwards (1)
  32.         useweapon(1)
  33.         weapon_shots=weapon_shots+1
  34.         -- Draw
  35.         terrainimage(cc.block.gfx_wpn,weapon_x,weapon_y)
  36.         -- Sound
  37.         playsound(cc.block.sfx_build)
  38.     end
  39. end